package com.tigercel.xiangchengyun.ui.activities

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import com.tigercel.xiangchengyun.R
import kotlinx.android.synthetic.main.activity_modify_sex.*
import kotlinx.android.synthetic.main.include_titlebar.*

class ModifySexActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_modify_sex)
        rl_man.setOnClickListener {
            img1.visibility = View.VISIBLE
            img2.visibility = View.INVISIBLE
        }
        rl_meal.setOnClickListener {
            img2.visibility = View.VISIBLE
            img1.visibility = View.INVISIBLE
        }
        titlebar_tv_right.visibility = View.VISIBLE
        titlebar_tv_right.text = "完成"
        titlebar_iv_left.visibility = View.VISIBLE
        titlebar_iv_left.setOnClickListener {
            this.finish()
        }
        titlebar_iv_left.setImageResource(R.drawable.btn_nav_back)
        titlebar_tv.text = "修改性别"
        titlebar_tv_right.setOnClickListener {
            if (img1.visibility == View.VISIBLE) {
                val data = Intent()
                data.putExtra("data", "男")
                setResult(2, data)
                this.finish()
            } else if (img2.visibility == View.VISIBLE) {
                val data = Intent()
                data.putExtra("data", "女")
                setResult(2, data)
                this.finish()
            }
        }

    }

}
